/* Copyright (C) Nial Peters 2014
 *
 * This file is part of pydoas.
 *
 * pydoas is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * pydoas is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with pydoas.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef _SHIFT_AND_SQUEEZE_H
#define _SHIFT_AND_SQUEEZE_H

#include "traceback.h"
#include <string.h>
#include <gsl/gsl_spline.h>


//// Type Declarations ////

typedef struct sns_data {

	int num_refs; //number of references
	int fit_window_length; //the length of the fitting window wavelengths array

	double *fitting_wavelengths; //the wavelengths of the fitting window
	gsl_interp_accel **accel_objs; //array of pointers to accelerator objects for spline interpolation
	gsl_spline **splines; //array of pointers to spline objects

} sns_data_t;



//// Function Prototypes ////

sns_data_t *
createSNSDataObj  (double **refs, int num_refs, double **ref_wavelengths,
		           int *ref_lengths, double *fitting_wavelengths,
		           int fit_window_length);

void
destroySNSDataObj (sns_data_t **data);

int
shiftAndSqueeze   (const sns_data_t *sns_data, const double shift,
				   const double squeeze, const int ref_num, double *output);


#endif //_SHIFT_AND_SQUEEZE_H
